package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.TaobaokeWidgetShopsConvertResponse;

/**
 * TOP API: taobao.taobaoke.widget.shops.convert request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class TaobaokeWidgetShopsConvertRequest implements TaobaoRequest<TaobaokeWidgetShopsConvertResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 需返回的字段列表.可选值:TaobaokeShop淘宝客商品结构体中的user_id,shop_title,click_url,
   * commission_rate;字段之间用","分隔.
   */
  private String              fields;

  /**
   * 标识一个应用是否来在无线或者手机应用,如果是true则会使用其他规则加密点击串.如果不传值,则默认是false.
   */
  private Boolean             isMobile;

  /**
   * 自定义输入串.格式:英文和数字组成;长度不能大于12个字符,区分不同的推广渠道,如:bbs,表示bbs为推广渠道;blog, 表示blog为推广渠道.
   */
  private String              outerCode;

  /**
   * 卖家昵称串.最大输入10个.格式如:"value1,value2,value3" 用" , "号分隔。
   */
  private String              sellerNicks;

  public void setFields(String fields) {
    this.fields = fields;
  }

  public String getFields() {
    return this.fields;
  }

  public void setIsMobile(Boolean isMobile) {
    this.isMobile = isMobile;
  }

  public Boolean getIsMobile() {
    return this.isMobile;
  }

  public void setOuterCode(String outerCode) {
    this.outerCode = outerCode;
  }

  public String getOuterCode() {
    return this.outerCode;
  }

  public void setSellerNicks(String sellerNicks) {
    this.sellerNicks = sellerNicks;
  }

  public String getSellerNicks() {
    return this.sellerNicks;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.taobaoke.widget.shops.convert";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("fields", this.fields);
    txtParams.put("is_mobile", this.isMobile);
    txtParams.put("outer_code", this.outerCode);
    txtParams.put("seller_nicks", this.sellerNicks);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<TaobaokeWidgetShopsConvertResponse> getResponseClass() {
    return TaobaokeWidgetShopsConvertResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(fields, "fields");
    RequestCheckUtils.checkNotEmpty(sellerNicks, "sellerNicks");
    RequestCheckUtils.checkMaxListSize(sellerNicks, 10, "sellerNicks");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
